<template>
    <div>

        <el-tabs v-model="activeName" @tab-click="handleClick">

            <el-tab-pane label="主页" name="home" ></el-tab-pane>
            <el-tab-pane label="搜索" name="search" ></el-tab-pane>
            <el-tab-pane label="购物车" name="shopping_cart" ></el-tab-pane>
            <el-tab-pane label="上传" name="upload_commodity" v-if="is_admin" ></el-tab-pane>
            <el-tab-pane label="登出" name="Index" ></el-tab-pane>

        </el-tabs>
        <transition mode="out-in">
            <router-view></router-view>
        </transition>


    </div>

</template>

<script>
    import {mapState} from 'vuex'
    export default {
        name: "Manage",
        data() {
            return {
                activeName: '',

            };
        },
        methods: {
            handleClick(tab, event) {

                this.$router.push("/"+tab.name);
                console.log(tab.name)

            }
        },
        computed: {

            ...mapState(['is_admin'])
        },
    }
</script>

<style scoped>

</style>